package com.example.jegotrip.utils;

import android.os.Build;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateUtil {
    private static final String pattern = "yyyy-MM-dd";

    public static String getCurrentFormattedTime(String pattern) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            LocalDateTime now = LocalDateTime.now();
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
            return now.format(formatter);
        }

        return pattern;
    }
}
